#include "Intreg.h"
sirIntreg::sirIntreg(int v[100])
{
for (int i=0; i<100;i++) 
this->v[i]=v[i];
}
int sirIntreg::getElement(int i)
{
return this->v[i];
}
int sirIntreg::nrElemente()
{
int i=0;
while (this->getElement(i)!=0) i++;
return i;
}
int sirIntreg::cmmdc(int a, int b)
{
while(a!=b){
if(a>b) a=a-b;
else b=b-a;
}
return a;
}
int sirIntreg::cmmdc()
{
int n=this->nrElemente(),j,cmmdc,a,b;
cmmdc=getElement(0);
for(int i=0;i<n-1;i++)
{
j=i+1;
a=this->getElement(i);
b=this->getElement(j);
while(a!=b){
if(a>b) a=a-b;
else b=b-a;
}
if (cmmdc>a) cmmdc=a;
}
return cmmdc;
}
